package com.lan.model;

import com.lan.model.symbol.Scope;
import org.antlr.v4.runtime.ParserRuleContext;

public class Variable extends Symbol {

    //变量类型
    private Type type = null;
    private Object value;

    public Variable(String id, String name, Scope scope, ParserRuleContext ctx) {
        this.id = id;
        this.name = name;
        this.scope = scope;
        this.ctx = ctx;
    }

    public Variable(Type type, Object value) {
        this.type = type;
        this.value = value;
    }


    public Variable(Type type, String name, Object value) {
        this.type = type;
        this.name = name;
        this.value = value;
    }


    public Variable(Type type) {
        this.type = type;
    }

    public Variable(String name, Object value) {
        this.name = name;
        this.value = value;
    }

    public Variable(Type type, String name) {
        this.name = name;
        this.type = type;
    }


    public Type getType() {
        return type;
    }

    public void setType(Type type) {
        this.type = type;
    }


    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return "Variable " + name + " -> " + type;
    }

}